//
//  KAAddAccount\CollectionCell.m
//  KeepAccount
//
//  Created by Veer on 2017/12/19.
//  Copyright © 2017年 Veer. All rights reserved.
//

#import "KAAddAccountCollectionCell.h"

#import "KACategoryModel.h"
#import "KABadgeModel.h"

@interface KAAddAccountCollectionCell()

@property (nonatomic, weak) UIImageView *iconView;
@property (nonatomic, weak) UILabel *titleLbl;

@end

@implementation KAAddAccountCollectionCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        [self setupSubView];
    }
    return self;
}

- (void)setupSubView
{
    UIImageView *iconView = [[UIImageView alloc] init];
//    iconView.image = [UIImage imageNamed:@"category_e_house_normal"];
//    iconView.highlightedImage = [UIImage imageNamed:@"category_e_house_selected"];
    [self.contentView addSubview:iconView];
    self.iconView = iconView;
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(self.contentView);
        make.height.mas_equalTo(iconView.mas_width);
    }];
    
    // 金额
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.text = @"工资";
    titleLbl.font = [UIFont systemFontOfSize:14];
    titleLbl.textColor = RGB(51, 51, 51);
    titleLbl.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:titleLbl];
    self.titleLbl = titleLbl;
    [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.contentView);
        make.bottom.mas_equalTo(0);
    }];
}


#pragma mark - setter && getter
- (void)setModel:(KACategoryModel *)model
{
    _model = model;
    
    self.iconView.image = [UIImage imageNamed:model.image_normal];
    self.iconView.highlightedImage = [UIImage imageNamed:model.image_selected];
    self.titleLbl.text = model.name;
}

- (void)setBadgeModel:(KABadgeModel *)badgeModel
{
    _badgeModel = badgeModel;
    
    self.iconView.image = badgeModel.status == 1 ? [UIImage imageNamed:badgeModel.image_get] : [UIImage imageNamed:badgeModel.image_notget];
    self.titleLbl.text = badgeModel.name;
    self.titleLbl.textColor = badgeModel.status == 1 ? RGB(50, 50, 50) : RGB(150, 150, 150);
    
}

@end
